package com.heima.wemedia.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.media.dtos.SensitiveResponseDTO;
import com.heima.wemedia.service.WmSensitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
public class WmSensitiveController {

    @Autowired
    private WmSensitiveService sensitiveService;

    /**
     * 保存敏感词 feign调用的接口
     */
    @PostMapping("/feign/save")
    public void saveSensitive(@RequestBody SensitiveDto dto) {
        sensitiveService.saveSensitive(dto);
    }

    /**
     * 查询列表 feign调用的接口
     */
    @PostMapping("/feign/list")
    public Page<SensitiveResponseDTO> findList(@RequestBody SensitiveDto dto) {
       return sensitiveService.findListByPage(dto);
    }

    /**
     * 修改敏感词 feign调用的接口
     */
    @PostMapping("/feign/update")
    public void updateSensitive(@RequestBody SensitiveDto dto) {
        sensitiveService.updateSensitive(dto);
    }

    /**
     * 删除敏感词 feign调用的接口
     */
    @DeleteMapping("/feign/del/{id}")
    public void deleteSensitive(@PathVariable("id") Integer id) {
        sensitiveService.deleteSensitive(id);
    }
}
